package com.minimalist.lindi.controller;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.subsidyapplicationpayrecord.LindiSubsidyApplicationPayRecordQueryVO;
import com.minimalist.common.entity.lindi.vo.subsidyapplicationpayrecord.LindiSubsidyApplicationPayRecordVO;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import com.minimalist.lindi.service.LindiSubsidyApplicationPayRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 林地指标交易平台_补贴申请支付记录控制器
 *
 * @author 11987
 */
@Validated
@RestController
@Tag(name = "林地指标交易平台_补贴申请支付记录管理")
@RequestMapping("/lindi/subsidyApplicationPayRecord")
public class LindiSubsidyApplicationPayRecordController{

    @Autowired
    private LindiSubsidyApplicationPayRecordService service;

    @PostMapping("/addSubsidyApplicationPayRecord")
    @Operation(summary = "添加补贴申请支付记录")
    public R<?> addSubsidyApplicationPayRecord(
            @RequestBody @Validated(Add.class)
            LindiSubsidyApplicationPayRecordVO subsidyApplicationPayRecordVO){
        service.addSubsidyApplicationPayRecord(subsidyApplicationPayRecordVO);
        return R.ok();
    }

    @DeleteMapping("/deleteSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId")
    @Operation(summary = "删除补贴申请支付记录 -> 根据补贴申请支付记录ID删除")
    public R<?> deleteSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId(
            @RequestParam("subsidyApplicationPayRecordId")
            @NotNull(message = "补贴申请支付记录ID不能为空")
            @Parameter(name = "subsidyApplicationPayRecordId", required = true, description = "补贴申请支付记录ID")
            Long subsidyApplicationPayRecordId){
        service.deleteSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId(subsidyApplicationPayRecordId);
        return R.ok();
    }

    @PutMapping("/updateSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId")
    @Operation(summary = "修改补贴申请支付记录")
    public R<?> updateSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId(
            @RequestBody @Validated(Update.class)
            LindiSubsidyApplicationPayRecordVO subsidyApplicationPayRecordVO){
        service.updateSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId(subsidyApplicationPayRecordVO);
        return R.ok();
    }

    @GetMapping("/getPageSubsidyApplicationPayRecordList")
    @Operation(summary = "查询补贴申请支付记录列表(分页)")
    public R<PageResp<LindiSubsidyApplicationPayRecordVO>> getPageSubsidyApplicationPayRecordList(
            @RequestBody LindiSubsidyApplicationPayRecordQueryVO queryVO){
        return R.ok(service.getPageSubsidyApplicationPayRecordList(queryVO));
    }

    @GetMapping("/getSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId/{subsidyApplicationPayRecordId}")
    @Operation(summary = "根据补贴申请支付记录ID查询补贴申请支付记录")
    public R<LindiSubsidyApplicationPayRecordVO> getSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId(
            @PathVariable(value = "subsidyApplicationPayRecordId")
            @NotNull(message = "补贴申请支付记录ID不能为空")
            @Parameter(name = "subsidyApplicationPayRecordId", description = "补贴申请支付记录ID", required = true)
            Long subsidyApplicationPayRecordId){
        return R.ok(service.getSubsidyApplicationPayRecordBySubsidyApplicationPayRecordId(subsidyApplicationPayRecordId));
    }

    @GetMapping("/getSubsidyApplicationPayRecordListBySubsidyApplicationId/{subsidyApplicationId}")
    @Operation(summary = "根据补贴申请ID查询支付记录列表")
    public R<PageResp<LindiSubsidyApplicationPayRecordVO>> getSubsidyApplicationPayRecordListBySubsidyApplicationId(
            @PathVariable(value = "subsidyApplicationId")
            @NotNull(message = "补贴申请ID不能为空")
            @Parameter(name = "subsidyApplicationId", description = "补贴申请ID", required = true)
            Long subsidyApplicationId){
        return R.ok(service.getSubsidyApplicationPayRecordListBySubsidyApplicationId(subsidyApplicationId));
    }
}